@extends('admin.header')
@section('title','管理员列表界面')
@section('content')
    <div class="col-sm-9 col-sm-offset-3 col-md-10 col-md-offset-2 main">
            <div class="col-md-12" id="content">
                <div class="app_content_div" id="app_content_div_301Index">
                    <h3>列表</h3>
                </div>
                <div>
                    <div style="float:right;">
                        <a href="/user/add-user" type="button" class="btn btn-primary">新增管理员</a>
                    </div>
                </div>
                <table class="table table-striped">
                    <thead>
                    <tr>
                        <th>id</th>
                        <th>用户名</th>
                        <th>更改密码</th>
                        <th>操作</th>
                    </tr>
                    </thead>
                    <tbody>
                    @foreach($users as $v)
                        <tr>
                            <td>{{$v->id}}</td>
                            <td>{{$v->name}}</td>
                            @method('DELETE')
                            <td><a style="cursor:pointer;" href="/user/edit-user/{{$v->id}}">更改密码</a></td>
                            <td>
                                <a onclick="deluser('/user/del-user/{{$v->id}}')" ><span class="glyphicon glyphicon-trash" aria-hidden="true"></span></a>
                            </td>
                        </tr>
                    @endforeach
                    </tbody>
                </table>
                <div class="center">{{$users->links('page2')}}</div>
            </div>
        </div>
    <script>
        function deluser(url){
            if(confirm("确定要删除吗？")){
                location.href = url;
            }
        }
    </script>
@endsection
